import 'package:gluz/generated/json/base/json_convert_content.dart';
import 'package:gluz/app/data/dictionary_entity.dart';

DictionaryEntity $DictionaryEntityFromJson(Map<String, dynamic> json) {
  final DictionaryEntity dictionaryEntity = DictionaryEntity();
  final String? dictCode = jsonConvert.convert<String>(json['dictCode']);
  if (dictCode != null) {
    dictionaryEntity.dictCode = dictCode;
  }
  final int? dictSort = jsonConvert.convert<int>(json['dictSort']);
  if (dictSort != null) {
    dictionaryEntity.dictSort = dictSort;
  }
  final String? dictLabel = jsonConvert.convert<String>(json['dictLabel']);
  if (dictLabel != null) {
    dictionaryEntity.dictLabel = dictLabel;
  }
  final String? dictValue = jsonConvert.convert<String>(json['dictValue']);
  if (dictValue != null) {
    dictionaryEntity.dictValue = dictValue;
  }
  final String? dictType = jsonConvert.convert<String>(json['dictType']);
  if (dictType != null) {
    dictionaryEntity.dictType = dictType;
  }
  final String? cssClass = jsonConvert.convert<String>(json['cssClass']);
  if (cssClass != null) {
    dictionaryEntity.cssClass = cssClass;
  }
  final String? listClass = jsonConvert.convert<String>(json['listClass']);
  if (listClass != null) {
    dictionaryEntity.listClass = listClass;
  }
  final String? isDefault = jsonConvert.convert<String>(json['isDefault']);
  if (isDefault != null) {
    dictionaryEntity.isDefault = isDefault;
  }
  final dynamic status = json['status'];
  if (status != null) {
    dictionaryEntity.status = status;
  }
  final String? remark = jsonConvert.convert<String>(json['remark']);
  if (remark != null) {
    dictionaryEntity.remark = remark;
  }
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    dictionaryEntity.createTime = createTime;
  }
  final bool? isSelected = jsonConvert.convert<bool>(json['isSelected']);
  if (isSelected != null) {
    dictionaryEntity.isSelected = isSelected;
  }
  return dictionaryEntity;
}

Map<String, dynamic> $DictionaryEntityToJson(DictionaryEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['dictCode'] = entity.dictCode;
  data['dictSort'] = entity.dictSort;
  data['dictLabel'] = entity.dictLabel;
  data['dictValue'] = entity.dictValue;
  data['dictType'] = entity.dictType;
  data['cssClass'] = entity.cssClass;
  data['listClass'] = entity.listClass;
  data['isDefault'] = entity.isDefault;
  data['status'] = entity.status;
  data['remark'] = entity.remark;
  data['createTime'] = entity.createTime;
  data['isSelected'] = entity.isSelected;
  return data;
}

extension DictionaryEntityExtension on DictionaryEntity {
  DictionaryEntity copyWith({
    String? dictCode,
    int? dictSort,
    String? dictLabel,
    String? dictValue,
    String? dictType,
    String? cssClass,
    String? listClass,
    String? isDefault,
    dynamic status,
    String? remark,
    String? createTime,
    bool? isSelected,
  }) {
    return DictionaryEntity()
      ..dictCode = dictCode ?? this.dictCode
      ..dictSort = dictSort ?? this.dictSort
      ..dictLabel = dictLabel ?? this.dictLabel
      ..dictValue = dictValue ?? this.dictValue
      ..dictType = dictType ?? this.dictType
      ..cssClass = cssClass ?? this.cssClass
      ..listClass = listClass ?? this.listClass
      ..isDefault = isDefault ?? this.isDefault
      ..status = status ?? this.status
      ..remark = remark ?? this.remark
      ..createTime = createTime ?? this.createTime
      ..isSelected = isSelected ?? this.isSelected;
  }
}